home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / go / prog / latex.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1993-06-20  |  10.8 KB  |  424 lines

  1. #! /bin/sh
  2. # This is a shell archive, meaning:
  3. # 1. Remove everything above the #! /bin/sh line.
  4. # 2. Save the resulting text in a file.
  5. # 3. Execute the file with /bin/sh (not csh) to create:
  6. #    eclgo.sty
  7. #    eclgo10.mf
  8. #    go.tex
  9. #    readme
  10. # This archive created: Sat Jun  1 12:44:01 1991
  11. export PATH; PATH=/bin:/usr/bin:$PATH
  12. if test -f 'eclgo.sty'
  13. then
  14.     echo shar: "will not over-write existing file 'eclgo.sty'"
  15. else
  16. cat << \SHAR_EOF > 'eclgo.sty'
  17. % eclgo.sty by Hideki ISOZAKI Apr. 27, 1991, May 6, 1991
  18.  
  19. \newcount\go@base
  20. \newdimen\go@size
  21. \newif\iffromwhite
  22. \fromwhitefalse
  23. \font\goftn=eclgo10 scaled 1440
  24. \font\gotwl=eclgo10 scaled 1200
  25. \font\goten=eclgo10 
  26. \@addfontinfo\@xivpt{\def\gf{\goftn}}
  27. \@addfontinfo\@xiipt{\def\gf{\gotwl}}
  28. \@addfontinfo\@xpt{\def\gf{\goten}}
  29. \@normalsize
  30.  
  31. %            <- pillar
  32. %           |
  33. % hand -> --*-- <- hand
  34. %           |
  35. %            <- pillar
  36. %
  37. \def\go@hand{\raise.5\go@size\hbox{%
  38.     \vrule\@depth.02\go@size\@height.02\go@size\@width.5\go@size}}
  39.  
  40. \def\go@hands{\raise.5\go@size\hbox{%
  41.     \vrule\@depth.02\go@size\@height.02\go@size\@width\go@size}}
  42.  
  43. \def\go@Hand{\raise.5\go@size\hbox{%
  44.     \vrule\@depth.03\go@size\@height.03\go@size\@width.5\go@size}}
  45.  
  46. \def\go@Hands{\raise.5\go@size\hbox{%
  47.     \vrule\@depth.03\go@size\@height.03\go@size\@width\go@size}}
  48.  
  49. \def\go@pillar{\hbox to \z@{\hss
  50.     \vrule\@depth\z@\@height.5\go@size\@width.04\go@size\hss}}
  51.  
  52. \def\go@pillars{\hbox to \z@{\hss
  53.     \vrule\@depth\z@\@height\go@size\@width.04\go@size\hss}}
  54.  
  55. \def\go@Pillar{\hbox to \z@{\hss
  56.     \vrule\@depth\z@\@height.5\go@size\@width.06\go@size\hss}}
  57.  
  58. \def\go@Pillars{\hbox to \z@{\hss
  59.     \vrule\@depth\z@\@height\go@size\@width.06\go@size\hss}}
  60.  
  61. \def\go@space{\kern.5\go@size}
  62.  
  63. \def\go@strut{\vrule\@height\go@size\@width\z@\@depth\z@}
  64.  
  65. \def\go@cross{\rlap{\go@space\go@pillars}\go@hands}
  66.  
  67. \def\go@mark{\rlap{\go@space\raise.5\go@size
  68.     \hbox to\z@{\makebox(0,0){$\bullet$}}}\go@cross}
  69.  
  70. \def\go@left{\go@space\go@Pillars\go@hand}
  71.  
  72. \def\go@right{\go@hand\go@Pillars\go@space}
  73.  
  74. \def\go@top{\go@strut\rlap{\go@space\go@pillar}\go@Hands}
  75.  
  76. \def\go@bot{\go@strut\rlap{\go@space\raise.5\go@size\go@pillar}\go@Hands}
  77.  
  78. \def\go@topleft{\go@strut\go@space\go@Pillar\go@Hand}
  79.  
  80. \def\go@topright{\go@strut\go@Hand\go@Pillar\go@space}
  81.  
  82. \def\go@botleft{\go@strut\go@space\raise.5\go@size\go@Pillar\go@Hand}
  83.  
  84. \def\go@botright{\go@strut\go@Hand\raise.5\go@size\go@Pillar\go@space}
  85.  
  86. \def\go@corner{%
  87.     \if\go@lr l%
  88.         \if\go@tb t%
  89.             \go@topleft\gdef\go@lr{r}%
  90.         \else
  91.             \go@botleft
  92.         \fi
  93.     \else
  94.         \if\go@tb t%
  95.             \go@topright\gdef\go@lr{r}%
  96.         \else
  97.             \go@botright
  98.         \fi
  99.     \fi}
  100.  
  101. \def\go@vbound{\if\go@lr l\go@left\gdef\go@lr{r}\else\go@right\fi}
  102. \def\go@hbound{\if\go@tb t\go@top\else\go@bot\fi}
  103.  
  104. {\obeyspaces\gdef\go@sp{\let =;}}
  105. {\obeylines\gdef\go@ln{\let^^M=:}}
  106.  
  107. \def\goban{\iffromwhite
  108.     \def\go@odd{60 }\def\go@even{0 }\else
  109.     \def\go@odd{0 }\def\go@even{60 }\fi\go@ban}
  110.  
  111. \def\go@ban{\let\go@end=\end\let\end=,%
  112.     \leavevmode\vbox\bgroup\offinterlineskip\gf
  113.         \settowidth{\go@size}{\char0}%
  114.         \obeyspaces\go@sp\gdef\go@lr{l}\gdef\go@tb{t}%
  115.         \obeylines\go@ln\hbox\bgroup\go@check}
  116.  
  117. \def\go@elem#1#2#3{\go@set#1#2#3\go@check}
  118.  
  119. \def\go@check#1{\def\go@c{#1}\xdef\go@quad{}%
  120.     \if\go@c:%
  121.         \egroup\hbox\bgroup\gdef\go@lr{l}%
  122.         \let\go@next=\go@check
  123.     \else
  124.         \if\go@c;%
  125.             \let\go@next=\go@elem
  126.         \else
  127.             \egroup\egroup\let\go@next=\go@end
  128.         \fi
  129.     \fi
  130.     \go@next}
  131.  
  132. \def\gostone{\begingroup\obeyspaces\go@sp\go@stone}
  133.  
  134.  
  135. \def\go@stone#1{\leavevmode\iffromwhite
  136.     \def\go@odd{60 }\def\go@even{0 }\lower.4ex\hbox{\gf\go@set#1}\else
  137.     \def\go@odd{0 }\def\go@even{60 }\lower.4ex\hbox{\gf\go@set#1}\fi
  138.     \endgroup}
  139.  
  140.  
  141. \def\go@set#1#2#3{%
  142.     \if#2;\if#3.\go@cross\gdef\go@tb{b}%
  143.           \else\if#3+\go@mark\gdef\go@tb{b}%
  144.           \else\if#3*\go@corner
  145.           \else\if#3!\go@vbound
  146.           \else\if#3-\go@hbound
  147.           \else\if#3b\hbox{\char120}\relax
  148.           \else\if#3w\hbox{\char121}\relax
  149.           \else   \ifodd#3\go@base=\go@odd\relax\else\go@base=\go@even\fi
  150.                   \hbox{\advance\go@base by #3\char\go@base}%
  151.           \fi\fi\fi\fi\fi\fi\fi
  152.     \else
  153.           \go@setnum#1#2#3%
  154.     \fi\gdef\go@lr{r}}
  155.  
  156. \def\go@setnum#1#2#3{%
  157.     \ifodd#3\go@base=\go@odd\else\go@base=\go@even\fi
  158.     \if#1;%
  159.      \hbox{\advance\go@base by #2\advance\go@base by 10\char\go@base}%
  160.      \hbox{\advance\go@base by #3\advance\go@base by 20\char\go@base}%
  161.     \else
  162.      \hbox{\advance\go@base by #1\advance\go@base by 30\char\go@base}%
  163.      \hbox{\advance\go@base by #2\advance\go@base by 40\char\go@base}%
  164.      \hbox{\advance\go@base by #3\advance\go@base by 50\char\go@base}%
  165.     \fi}
  166. % <\hbox>es circumscribing each stone (fragment) are unnecessary.
  167. % However, I had to use dvi2vdu which had a bug of setchar
  168. % when I was developing this style file.
  169.  
  170.  
  171. SHAR_EOF
  172. fi
  173. if test -f 'eclgo10.mf'
  174. then
  175.     echo shar: "will not over-write existing file 'eclgo10.mf'"
  176. else
  177. cat << \SHAR_EOF > 'eclgo10.mf'
  178. % eclgo10.mf by Hideki ISOZAKI Apr. 27, 1991
  179. mode_setup;
  180.  
  181. def andonly = cull currentpicture dropping (-infinity,1) enddef;
  182. def clipit = fill (-lap#,0)--(w+lap#,0)--(w+lap#,h)--(-lap#,h)--cycle; andonly; enddef;
  183. def atcenter = shifted (.5h,.5h) enddef;
  184. def hcirc = fullcircle scaled h enddef;
  185.  
  186. hwc=1/6/sqrt(2); % diameter --> half width of a char
  187.  
  188. u#:=10pt#;
  189. lap#:=0.6pt#;
  190.  
  191. path num[];
  192. pair p[];
  193.  
  194. %  ------------------------
  195. %  |                      |
  196. %  |   ****************   |
  197. %  |   *** PATH DATA **   |
  198. %  |   * / ORIGIN *****   |
  199. %  |    / *************   |
  200. %  |xxxx **************   |
  201. %  |xxxx              |
  202. %  ------------------------
  203. %  x... p0, *... p1, whole... 2p0+p1     
  204.                                
  205. p0=(2,1); % overshoot margin (xxx region)
  206. p1=(4,8); % width & height of *** region
  207. p2=-0.5(2p0+p1); % centering           
  208. p3=p0+p2; % centering after adding overshoot margin
  209.  
  210. (xp,yp)=-2sqrt(2)*p2; % diameter --> edge length
  211.  
  212. num[0]=((2,0)..(4,4)..(2,8)..(0,4)..cycle) shifted p3;
  213. num[1]=((1,7)--(2,8)--(2,0)) shifted p3;
  214. num[2]=((0,6)..(2,8)..(4,6){dir -90}..{dir -90}(0,0)--(4,0)) shifted p3;
  215. num[3]=((0,6)..(2,8)..(4,7)..(4,5)..(2,4)&
  216.     (2,4)..(4,3)..(4,1)..(2,0)..(0,2)) shifted p3;
  217. num[4]=((4,2)--(0,2)--(3,8)--(3,0)) shifted p3;
  218. num[5]=((4,8)--(0,8)--(0,4)...(2,5)..(4,2)..(2,0)..(0,1)) shifted p3;
  219. num[6]=((4,7)..(2,8){dir 180}..(0,4){dir 270}..(2,0){dir 360}..(4,2){dir 450}
  220.     ..(2,5){dir 540}..{dir 630}(0,2)) shifted p3;
  221. num[7]=((0,6)--(0,8)--(4,8)--(4,7)..{dir -90}(2,0)) shifted p3;
  222. num[8]=((2,0)..(4,2)..(2,4)..(0,6)..(2,8)..(4,6)..(2,4)..(0,2)..cycle)
  223.     shifted p3;
  224. num[9]=num[6] rotated 180;
  225.  
  226. extra_beginchar := "pickup pencircle scaled 0.7pt;";
  227.  
  228. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  229. %   White on Black
  230. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  231.  
  232. % One digit
  233.  
  234. for c=0 upto 9:
  235. beginchar(c,u#,u#,0); 
  236.     fill hcirc atcenter; cullit;
  237.     undraw num[c] 
  238.         xscaled (w/xp) yscaled (h/yp) atcenter;
  239. endchar;
  240. endfor;
  241.  
  242. % Two digits left part
  243.  
  244. for c=0 upto 9:
  245. beginchar(c+10,.5u#,u#,0); 
  246.     fill hcirc atcenter; clipit;
  247.     undraw num[c] shifted (xpart p2,0)
  248.         xscaled (.5h/xp) yscaled (h/yp) atcenter;
  249. endchar;
  250. endfor;
  251.  
  252. % Two digits right part
  253.  
  254. for c=0 upto 9: 
  255. beginchar(c+20,.5u#,u#,0); 
  256.     fill hcirc shifted (0,.5h); clipit;
  257.     undraw num[c] shifted (-xpart p2,0)
  258.         xscaled (.5h/xp) yscaled (h/yp) shifted (0,.5h);
  259. endchar;
  260. endfor;
  261.  
  262. % Three digits left part
  263.  
  264. for c=0 upto 9:
  265. beginchar(c+30,.5u#*(1-2hwc),u#,0); 
  266.     fill hcirc atcenter; clipit;
  267.     undraw num[c] shifted (2xpart p2,0)
  268.         xscaled (h/3/xp) yscaled (h/yp) atcenter;
  269. endchar;
  270. endfor;
  271.  
  272.  
  273. % Three digits center part
  274.  
  275. for c=0 upto 9:
  276. beginchar(c+40,u#*2hwc,u#,0); 
  277.     fill hcirc shifted (h*hwc,.5h); clipit;
  278.     undraw num[c] 
  279.         xscaled (h/3/xp) yscaled (h/yp) shifted (h*hwc,.5h);
  280. endchar;
  281. endfor;
  282.  
  283. % Three digits right part
  284.  
  285. for c=0 upto 9: 
  286. beginchar(c+50,.5u#*(1-2hwc),u#,0); 
  287.     fill hcirc shifted (-h*hwc,.5h); clipit;
  288.     undraw num[c] shifted (-2xpart p2,0)
  289.         xscaled (h/3/xp) yscaled (h/yp) shifted (-h*hwc,.5h);
  290. endchar;
  291. endfor;
  292.  
  293. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  294. %   Black on White
  295. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  296. % One digit
  297.  
  298. for c=0 upto 9:
  299. beginchar(c+60,u#,u#,0); 
  300.     draw hcirc atcenter; cullit;
  301.     fill hcirc atcenter; andonly;
  302.     draw num[c] 
  303.         xscaled (w/xp) yscaled (h/yp) atcenter;
  304. endchar;
  305. endfor;
  306.  
  307. % Two digits left part
  308.  
  309. for c=0 upto 9:
  310. beginchar(c+70,.5u#,u#,0); 
  311.     draw hcirc atcenter; cullit;
  312.     fill hcirc atcenter; andonly; clipit;
  313.     draw num[c] shifted (xpart p2,0)
  314.         xscaled (.5h/xp) yscaled (h/yp) atcenter;
  315. endchar;
  316. endfor;
  317.  
  318. % Two digits right part
  319.  
  320. for c=0 upto 9: 
  321. beginchar(c+80,.5u#,u#,0); 
  322.     draw hcirc shifted (0,.5h); cullit;
  323.     fill hcirc shifted (0,.5h); andonly; clipit;
  324.     draw num[c] shifted (-xpart p2,0)
  325.         xscaled (.5h/xp) yscaled (h/yp) shifted (0,.5h);
  326. endchar;
  327. endfor;
  328.  
  329. % Three digits left part
  330.  
  331. for c=0 upto 9:
  332. beginchar(c+90,.5u#*(1-2hwc),u#,0); 
  333.     draw hcirc atcenter; cullit;
  334.     fill hcirc atcenter; andonly; clipit;
  335.     draw num[c] shifted (2xpart p2,0)
  336.         xscaled (h/3/xp) yscaled (h/yp) atcenter;
  337. endchar;
  338. endfor;
  339.  
  340.  
  341. % Three digits center part
  342.  
  343. for c=0 upto 9:
  344. beginchar(c+100,u#*2hwc,u#,0); 
  345.     draw hcirc shifted (h*hwc,.5h); cullit;
  346.     fill hcirc shifted (h*hwc,.5h); andonly; clipit;
  347.     draw num[c] 
  348.         xscaled (h/3/xp) yscaled (h/yp) shifted (h*hwc,.5h);
  349. endchar;
  350. endfor;
  351.  
  352. % Three digits right part
  353.  
  354. for c=0 upto 9: 
  355. beginchar(c+110,.5u#*(1-2hwc),u#,0); 
  356.     draw hcirc shifted (-h*hwc,.5h); cullit;
  357.     fill hcirc shifted (-h*hwc,.5h); andonly; clipit;
  358.     draw num[c] shifted (-2xpart p2,0)
  359.         xscaled (h/3/xp) yscaled (h/yp) shifted (-h*hwc,.5h);
  360. endchar;
  361. endfor;
  362. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  363. %  Stones without numbers
  364. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  365.  
  366. beginchar(120,u#,u#,0);
  367.     fill hcirc atcenter;
  368. endchar;
  369.  
  370. beginchar(121,u#,u#,0);
  371.     draw hcirc atcenter; cullit;
  372.     fill hcirc atcenter; andonly;
  373. endchar;
  374.  
  375. end
  376. SHAR_EOF
  377. fi
  378. if test -f 'go.tex'
  379. then
  380.     echo shar: "will not over-write existing file 'go.tex'"
  381. else
  382. cat << \SHAR_EOF > 'go.tex'
  383. % go.tex by Hideki ISOZAKI Apr. 27, 1991
  384. \documentstyle[eclgo]{article}
  385.  
  386. \begin{document}
  387.  
  388. \fromwhitetrue
  389. \gostone{  w} \gostone{911} \gostone{ 32}
  390.  
  391. \noindent
  392. \begin{goban}
  393.    *   w   -   w   -   -  13   -   -   -   -   4   -   -   -   -   -   -   *
  394.    !  32   b   .  25   .   +   .  54   .  49   .  28   .   +   .   .   .   !
  395.    !   b   .  86  45   7   .  14   .  30   .   .   .   .   . 127   .   .   !
  396.    *   -   -   -   - 182   -   -   -   -   -   -   -   -   -   -   -   -   *
  397. \end{goban}
  398.  
  399. \fromwhitefalse\Large
  400. \gostone{  w} \gostone{911} \gostone{ 32}
  401.  
  402. \noindent
  403. \begin{goban}
  404.    *   w   -   w   -   -  13   -   -   -   -   4   -   -   -   -   -   -   *
  405.    !  32   b   .  25   .   +   .  54   .  49   .  28   .   +   .   .   .   !
  406.    !   b   .  86  45   7   .  14   .  30   .   .   .   .   . 127   .   .   !
  407.    *   -   -   -   - 182   -   -   -   -   -   -   -   -   -   -   -   -   *
  408. \end{goban}
  409. \end{document}
  410. SHAR_EOF
  411. fi
  412. if test -f 'readme'
  413. then
  414.     echo shar: "will not over-write existing file 'readme'"
  415. else
  416. cat << \SHAR_EOF > 'readme'
  417. This package is by:  isozaki@penguin.stanford.edu
  418.  
  419.  
  420. SHAR_EOF
  421. fi
  422. exit 0
  423. #    End of shell archive
  424.